<template>
    <div>

              <el-table :data="tableData" border style="width: 100%">
                      <el-table-column prop="type" label="类型" width="120">
        </el-table-column>
        <el-table-column prop="name" label="姓名" width="80">
        </el-table-column>
           <el-table-column prop="mobile" label="手机号" width="120">
        </el-table-column>
           <el-table-column prop="dabh" label="身份证号" width="180">
        </el-table-column>
     
            <el-table-column prop="createdate" label="签署日期" width="180">
                <template slot-scope="scope" >
                     <!-- <el-button size="small" type="primary" @click="viewMenu(scope.row)">查看任命书</el-button> -->
                     <div v-if="scope.row.createdate">已签署({{scope.row.createdate}})</div>
                     <div v-else class="red">未签署</div>
            </template> 
        </el-table-column>

         <el-table-column prop="contactAddress" label="联系地址" ></el-table-column>
          <el-table-column prop="createdate" label="操作" width="120">
             <template slot-scope="scope" v-if="scope.row.createdate&&scope.row.type!='企业负责人'">
                     <el-button size="small" type="primary" @click="viewMenu(scope.row)">查看任命书</el-button>
            </template> 
        </el-table-column>
              </el-table>
    </div>
</template>
<script>
import { findPeopleType,getPdfResponsibilityRecord ,CompanyMainPageInfo} from "@/api/modules/enterprise";
export default {
  // props:[],
  // 页面加载
  created() {
    this.getList();
  },
  // 页面加载完成
  mounted() {},
  //实例销毁之前
  beforeDestroy() {},
  //实例销毁后
  destroyed() {},
  data() {
    return {
      tableData: [],
    };
  },
  // 方法
  methods: {
    async getList() {
      let { data } = await findPeopleType({
        id: sessionStorage.getItem("interpretation"),
      });
      






       this.tableData=data.foodSafetyInfoResponseList.list.map((x)=>{
        return {
            name:x.name||x.loginname,
            dabh:x.dabh,
            mobile:x.mobile,
            createdate:x.signCreateDateStr||"",
            type:"食品安全员",
         id:x.signId,


         contactAddress:x.contactAddress
        }
      })
      this.tableData.push({
            name: data.principalOfTheEnterprise&&data.principalOfTheEnterprise.signTheName||"--",
            dabh:"--",
            mobile:data.principalOfTheEnterprise&&data.principalOfTheEnterprise.signMobile||"--",
            createdate:data.principalOfTheEnterprise&&data.principalOfTheEnterprise.signCreateDateStr||"",
           id:data.principalOfTheEnterprise&&data.principalOfTheEnterprise.signId||"",
            type:"企业负责人",

            contactAddress:data.principalOfTheEnterprise.contactAddress
      })


      //   CompanyMainPageInfo({
      //   params: {
      //     id: sessionStorage.getItem("interpretation"),
      //   },
      // }).then((res) => {
              // if(res.data.label=='总监企业'){
  this.tableData.push({
            name: data.foodSafetyOfficer&&data.foodSafetyOfficer.signTheName||"--",
            dabh:data.foodSafetyOfficer&&data.foodSafetyOfficer.dabh||"--",
            mobile:data.foodSafetyOfficer&&data.foodSafetyOfficer.signMobile||"--",
            createdate:data.foodSafetyOfficer&&data.foodSafetyOfficer.signCreateDateStr||"",
            type:"食品安全总监",
            id:data.foodSafetyOfficer&&data.foodSafetyOfficer.signId||"",
              contactAddress:data.foodSafetyOfficer.contactAddress
      })
              // }
      // });



     
    },
  async  viewMenu(e){
             let { data } = await  getPdfResponsibilityRecord({params:{ id: e.id}})
             this.$downloadFiles(data)
    }
  },
  // 监听属性
  watch: {},
  // 组件
  components: {},
  // 计算属性
  computed: {},
};
</script>

<style lang="scss" scoped>
</style>